package com.netintech.core.checkWeakPwd.service.impl;


import com.netintech.core.checkWeakPwd.mapper.SysWeakpasswordMapper;
import com.netintech.core.checkWeakPwd.service.SysWeakpasswordService;
import com.netintech.core.checkWeakPwd.utils.PassWordUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class SysWeakpasswordServiceImpl implements SysWeakpasswordService {
    @Autowired
    private SysWeakpasswordMapper sysWeakpasswordMapper;


    @Override
    public boolean checkWeakPwd(String pwd) {
        Map<String, String> map = new HashMap<>();
        map.put("code", pwd);
        int count = sysWeakpasswordMapper.findCountByPassword(map);
        if (PassWordUtil.check_numl(pwd) || PassWordUtil.check_numz(pwd) || count > 0) {
            return true;
        }
        return false;
    }
}
